﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using Autodesk.Revit.DB;
using YArchitech.LIB;
using YJKCodeBase.WinForm;

namespace EditColumn.ConnectColumnBream
{
	public partial class SelectViewPlanForm : System.Windows.Forms.Form
	{
		public SelectViewPlanForm(Dictionary<string, ViewPlan> dicDocViewPlan, WindowHandle hWndRevit)
		{
			this.InitializeComponent();
			this.AddCheckBox(dicDocViewPlan);
			this.m_hWndRevit = hWndRevit;
		}

		private void button3_Click(object sender, EventArgs e)
		{
		}

		private void button1_Click(object sender, EventArgs e)
		{
			foreach (KeyValuePair<string, RadioButton> keyValuePair in this.m_dicRadioButton)
			{
				if (keyValuePair.Value.TabStop)
				{
					this.m_OpenViewPlanName = keyValuePair.Key;
					break;
				}
			}
		}

		private void AddCheckBox(Dictionary<string, ViewPlan> dicDocViewPlan)
		{
			int num = 0;
			foreach (KeyValuePair<string, ViewPlan> keyValuePair in dicDocViewPlan)
			{
				RadioButton radioButton = new RadioButton();
				radioButton.AutoSize = true;
				radioButton.Location = new System.Drawing.Point(4, 5 + 23 * num);
				radioButton.Name = "radioButton" + num.ToString();
				radioButton.Size = new Size(95, 16);
				radioButton.TabIndex = num;
				radioButton.TabStop = true;
				radioButton.Text = keyValuePair.Key;
				radioButton.UseVisualStyleBackColor = true;
				this.panel1.Controls.Add(radioButton);
				this.panel1.Show();
				this.panel1.Update();
				this.m_dicRadioButton.Add(keyValuePair.Key, radioButton);
				num++;
			}
		}

		public string OpenViewPlanName
		{
			get
			{
				return this.m_OpenViewPlanName;
			}
		}

		private void SelectViewPlanForm_KeyDown(object sender, KeyEventArgs e)
		{
			if (e.KeyCode == Keys.Escape)
			{
				base.Close();
			}
		}

		private void SelectViewPlanForm_Load(object sender, EventArgs e)
		{
			//base.Icon = Resource.YArchitechIcon;
		}

		private string m_OpenViewPlanName;

		private WindowHandle m_hWndRevit;

		private Dictionary<string, RadioButton> m_dicRadioButton = new Dictionary<string, RadioButton>();
	}
}
